<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2015/11/11
 * Time: 20:56
 */
class Macs_model extends CI_Model
{
    private $_table  = 'macs';
    private $_table1 = 'goods_map_cpt';

    public function findBySid($sid)
    {
        $this->db->select('mac_id,order_id,sid');
        $this->db->from($this->_table);
        $this->db->where('isfree', 'N');
        $this->db->where('sid', $sid);
        return $this->db->get();
    }

    /**
     * 查找检票机器编号
     */
    public function findGoodsMacs($goodsId)
    {
    	$this->db->select('mac_id');
    	$this->db->from($this->_table.' AS macs');
    	$this->db->join($this->_table1.' AS goods_map_cpt', 'goods_map_cpt.uid=macs.teller_uid', 'INNER');
    	$this->db->where('goods_map_cpt.goods_id', $goodsId);

    	return $this->db->get();
    }

}